<template>
  <div>
    <van-nav-bar
        title="选择门店"
        :left-arrow="true"
        @click-left="onClickLeft"
    />
    <van-card v-for="item in list" :key="item.id" :thumb="item.img" @click="replace(item)">
      <div slot="title">{{ item.mdname }}</div>
      <div slot="desc">{{ item.address }}</div>
    </van-card>


  </div>
</template>
<script>
import {ref} from 'vue';
import axios from "axios";
import { Dialog } from 'vant';
export default {
  data() {
    return {
      chosenAddressId: 1,
      leftText: "11",
      list: [],
      formm:{
        mdname:'',
      },
    };
  },
  methods: {
    replace(row){
      Dialog.confirm({
        title: '确认提示',
        message: '是否选择此门店？'
      })
          .then(() => {
            // 点击确定时的操作
            //传递参数
            this.$router.push({path:'/settlement',query:{MenDian:row}})
          })
          .catch(() => {
            // 点击取消时的操作
            this.$toast('已取消');
          });
    },
    onClickLeft() {
      // 处理左侧点击的逻辑
      console.log("左侧点击");
      //返回上一页
      this.$router.go(-1)
    },
  },
  created() {
    this.axios.post('http://1.94.221.254:9999/api-qcfw-mendian/mendian/findMendianAll',this.formm).then(res => {
      this.list = res.data
    })
  },

};
</script>
